package zero.tech.games.user.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import zero.tech.games.entity.user.TUser;

public interface TUserMapper {

	@Select("select * from t_user where phone=#{phone}")
	TUser selectUserByPhone(String phone);

	@Insert("insert into t_user(idno,nick,head_img,sex,ai,phone,pwd,"
			+ "wchat,regist_time)"
			+ " values(#{idno},#{nick},#{head_img},#{sex},#{ai},#{phone},#{pwd},"
			+ "#{wchat},#{regist_time})")
	@Options(useGeneratedKeys = true, keyProperty = "uid")
	void insert(TUser user);

	@Select("select * from t_user where uid=#{uid}")
	TUser getUser(int uid);

	@Update("update t_user set idno=#{idno},nick=#{nick},head_img=#{head_img},sex=#{sex},"
			+ "ai=#{ai},phone=#{phone},pwd=#{pwd},wchat=#{wchat},regist_time=#{regist_time} where uid=#{uid}")
	void update(TUser user);

	List<TUser> getUserBatch(List<Integer> list);

}
